<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script type="text/javascript" src="__STATIC__/jquery.js"></script>
    <script type="text/javascript" src="__STATIC__/ajaxfileupload.js"></script>
</head>
<body>

<script type="text/javascript">

    function ajaxFileUpload()
    {
        $.ajaxFileUpload
        (
                {
                    url:'{:U("House/Index/upload")}',
                    secureuri:false,
                    fileElementId:'img',
                    dataType: 'json',
                    success: function (data, status)
                    {

                       var msg = JSON.parse(data);
                        var html = '<img onclick="img_del($(this))" style="width: 120px;height:90px;float: left;margin-right: 10px;" src="'+msg.img.path+'">';
                        $('#showImg').append(html);
                        window.top.document.getElementById('photo').value += '['+msg.img.path+']';

                    },
                    error: function (data, status)
                    {
                       // alert(status);
                  }
                }
        )

        return false;

    }
  /*  $(document).ready(function(){

        //触发onclick事件

        $("#del").click(

                function(){

                    $("#showImg img:last").remove();      //删除子节点

                }

        );

    });*/

    function img_del(obj){

        var r=confirm("确认删除")

        if (r==true)

        {
           // return true;


            window.top.document.getElementById('photo').value =  window.top.document.getElementById('photo').value.replace('['+obj.attr('src')+']','');
            obj.remove();

        }

        else
        {
            return false;
        }

    }






</script>


<div style="margin-bottom: 10px;margin-left: 14px;margin-top: 5px;"><input id="img" type="file" size="45" name="img" class="input">
<button class="button" id="buttonUpload" onclick="return ajaxFileUpload();">上传</button>&nbsp;&nbsp;<span>最多可上传6张图片，请至少上传3张图片,点击图片可删除</span></div>

<div id="showImg" style="height: 90px;float: left;margin-left: 14px"></div>



<script type="text/javascript">
function getParent() {

}
</script>




<script type="text/javascript">
function getParent() {

}
</script>


</body>
</html>